<template>
  <div class="initiateEvaluationMain">
    <div class="initiateEvaluationBox">
      <h3>发起评价</h3>
      <div class="inputBox">
        <el-input
          type="textarea"
          placeholder="写下你的评论..."
          v-model="form.content"
          maxlength="100"
          :rows="6"
          show-word-limit
        />
      </div>
      <div class="submitBox flex align-center justify-end">
        <!--<div class="anonymous">-->
        <!--<el-checkbox v-model="checked">匿名评价</el-checkbox>-->
        <!--</div>-->
        <el-button type="primary" @click="submit" >提交评价</el-button>
      </div>
    </div>
  </div>
</template>
<script>
import {addComment } from '@/api/model/comment'
export default {
  name: '',
  props: {
    modelBasicInfoId:{
      type:String,
      required:true,
    }
  },
  components: {},
  data() {
    return {
      textarea: '',
      form:{
        modelId:'',
        content:'',
        source:'1',//1 门户
      },
      checked: false,
    }
  },
  computed: {},
  watch: {},
  created() {
  },
  mounted() {
  },
  methods: {
   async submit(){
     if(!this.form.content){
       this.$modal.msgError("请填写后再评价");
       return
     }
     this.form.modelId = this.modelBasicInfoId;
     const resp = await addComment(this.form);
     if(resp.code === 200){
       this.$modal.msgSuccess("模型评论成功。");
       this.form.content = '';
     }
    },



  },
}
</script>
<style lang="scss" scoped>
.initiateEvaluationBox {
  margin-top: 15px;
  padding: 5px 15px 15px;
  background: rgba(28, 31, 33, .06);
  border-radius: 8px;
  background: #fff;

  > h3 {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin: 0;
    line-height: 60px;
    color: #666;
  }

  .submitBox {
    padding-top: 15px;
  }
}
</style>
